package mybatis.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import mybatis.dao.TeacherDao;
import mybatis.service.IFamilyService;
import mybatis.service.ITeacherService;

@Transactional(propagation=Propagation.SUPPORTS)
@Service
public class TeacherServiceImpl implements ITeacherService {
    @Autowired
    private TeacherDao teacherDao;
    @Autowired
    private IFamilyService familyService;

     @Override
    public  void update(Long id, String name) {
//        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
//        TeacherDao teacherDao = ac.getBean(TeacherDao.class);
        teacherDao.updateById(id, name);
        familyService.update(id, name);
    }

}
